import { createRouter, createWebHistory } from 'vue-router';
import Layout from '@/layouts/default.vue';
import Home from '@/views/home/index.vue';
import Role from '@/views/system/role.vue';

const routes = [{
  path: '/register',
  name: 'Register',
  component: () => import('@/views/login/register.vue'),
},{
  path: '/login',
  name: 'Login',
  component: () => import('@/views/login/index.vue'),
}, {
  path: '/',
  redirect: 'home',
  component: Layout,
  children: [{
    path: '/',
    name: 'home',
    component: Home
  }, {
    path: 'role-manage',
    name: 'role-manage',
    component: Role,
    meta: {
      title: '角色管理',
      icon: 'user',
    }
  }, {
    path: 'user-manage',
    name: 'user-manage',
    component: () => import('@/views/system/user.vue'),
    meta: {
      title: '用户管理',
      icon: 'user',
    }
  }, {
    path: 'menu-manage',
    name: 'menu-manage',
    component: () => import('@/views/system/menu.vue'),
    meta: {
      title: '菜单管理',
      icon: 'user',
    }
  }]
}]

const router = createRouter({
  history: createWebHistory(),
  routes,
});



export default router;